
import { _decorator, Component, Node, director, Animation } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('ButtonPlay')
export class ButtonPlay extends Component {
    /**
     * 加载游戏场景
     * @private
     */
    private loadGame(){
        director.loadScene('Game');
    }

    /**
     * 点击结束回调事件
     * @private
     */
    private onTouchEnd(){
        this.node.getComponent(Animation)!.play();
    }

    /**
     * onLoad() 中注册按钮回调事件
     * @protected
     */
    protected onLoad() {
        this.node.on(Node.EventType.TOUCH_END, this.onTouchEnd, this);
    }

    /**
     * onDestroy() 中注销按钮回调事件
     * @protected
     */
    protected onDestroy() {
        this.node.off(Node.EventType.TOUCH_END, this.onTouchEnd, this);
    }}